@extends('layouts.admin')

@section('title', '分类列表')

@section('content')
    <div class="container">
        <p class="lead">分类列表
            <a class="btn btn-info btn-xs" href="{{route('admin.category.create')}}">添加新的分类</a>
        </p>
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>名称</th>
                    <th>产品数量</th>
                    <th>特色图片</th>
                    <th>别名</th>
                    <th>更新日期</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($categories as $category)
                    <tr>
                        <td>{{ $category->id }}</td>
                        <td>{{ $category->title }}
                        <td><span class="badge">{{ $category->products->count() }}</span></td>
                        <td><img src="{{ asset($category->image_url) }}" title="{{ $category->title }}" style="width: 50px"></td>
                        <td>{{ $category->slug }}
                        <td>{{ $category->updated_at }}</td>
                        <td><a href="{{route('admin.category.edit', array('id' => $category->id))}}">编辑</a> | <a href="#">删除</a> </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="text-center">
            {!! $categories->render() !!}
        </div>
    </div>
@stop